<html style="background-color: black;">
<head>
  <meta charset="utf-8"/>
	<script src="/jquery-2.1.1/jquery.min.js"></script>
<style>
.input-text {
    display: inline-block;
    background-color: transparent;
    border: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    outline: 0;
    box-sizing: border-box;
    font-size: 17px;
    font-family: Monaco, Cutive Mono, Courier New, Consolas, monospace;
    font-weight: 700;
    color: #fff;
    width: 300px;
    padding-block-end: 0
}
* {
    cursor: text;
}
#usr {
    color: rgb(193, 54, 70);
}
.host {
    color: rgb(60, 187, 198);
}
</style>
</head>
<body style="font-family: Monaco, Cutive Mono, Courier New, Consolas, monospace;font-weight: 700;font-size: 17px;line-height: 23px;color: white;">
<div id="main">
Last login: Fri Mar 2 17:55:16 on ttys004<br>
[caicaiblog] Random theme '/Users/juruo_cjl/.caicaiblog/themes/orzsjy-theme' loaded...<br>
<div style="line-height: 1;margin: 10px;">
<span style="color:rgb(59, 187, 51)">############&nbsp;</span><br>
<span style="color:rgb(59, 187, 51)">###&nbsp;########&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">User:&nbsp;</span>juruo_cjl<br>
<span style="color:rgb(59, 187, 51)">&nbsp;###&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;##</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Hostname:&nbsp;</span>caiji'blog<br>
<span style="color:rgb(59, 187, 51)">&nbsp;&nbsp;###&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Distro:&nbsp;</span>CAICAI Blog X 1.0.0<br>
<span style="color:rgb(174, 172, 51)">&nbsp;&nbsp;&nbsp;##&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Kernel:&nbsp;</span>orzsjy<br>
<span style="color:rgb(174, 172, 51)">&nbsp;&nbsp;&nbsp;&nbsp;##&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Uptime:&nbsp;</span>998244353days<br>
<span style="color:rgb(193, 57, 40)">&nbsp;&nbsp;&nbsp;&nbsp;###&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Shell:&nbsp;</span>/bin/cjl<br>
<span style="color:rgb(193, 57, 40)">&nbsp;&nbsp;&nbsp;&nbsp;##&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Terminal:&nbsp;</span>xterm-256color<br>
<span style="color:rgb(193, 57, 40)">&nbsp;&nbsp;&nbsp;##&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Packages:&nbsp;</span>1234567<br>
<span style="color:rgb(211, 67, 201)">&nbsp;&nbsp;&nbsp;#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#</span>&nbsp;
<span style="color:rgb(60, 187, 198)">CPU:&nbsp;</span>Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz<br>
<span style="color:rgb(211, 67, 201)">&nbsp;&nbsp;#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Memory:&nbsp;</span>32GB<br>
<span style="color:rgb(83, 58, 221)">&nbsp;###########&nbsp;</span>&nbsp;
<span style="color:rgb(60, 187, 198)">Disk:&nbsp;</span>3TB<br>
<span style="color:rgb(83, 58, 221)">############&nbsp;</span>
</div>
Hi,I'm juruo cjl,this is terminal of my blog.Welcome to use it.<br>
'help' to get more information.<br>
</div>
<span class="prefix">(AFOed)[<span id='usr'>juruo_cjl</span>@<span class="host">caijiblog</span> <span id="pos">~</span>]$ </span>
<input type="text" class="input-text">
<script>
if (window.BigInt) { // bigint is available
	let B = window.BigInt;
	function PowerMod(a, n, m) {
		let c = B(1);
		for (a %= m; n; n >>= B(1), a = a * a % m)
			if (n & B(1)) c = c * a % m;
		return c % m;
	}
	function tr(s, name) {
		if (s === '') return name + ' is not a valid integer';
		try {
			return B(s);
		} catch (e) {
			return name + ' is not a valid integer';
		}
	}
	window.pow = function(a, n, m) {
		if (a = tr(a, 'a'), typeof a !== 'bigint') return a;
		if (n = tr(n, 'n'), typeof n !== 'bigint') return n;
		if (n < 0) return 'n is negative';
		if (m = tr(m, 'm'), typeof m !== 'bigint') return m;
		if (m <= 0) return 'm is not positive';
		return PowerMod(a % m + m, n, m);
	}
	function Miller_Rabin(n) {
		let c = B(0), j, s = n - B(1), u, v;
		for (; !(s & B(1)); ++c, s >>= B(1));
		for (let p of [2, 3, 5, 7, 11, 13, 82, 373].map(B)) {
			if (!(n % p)) return false;
			u = PowerMod(p, s, n);
			for (j = B(0); j < c; ++j, u = v)
				if (v = u * u % n, u != 1 && u !== n - B(1) && v == 1) return false;
			if (u != 1) return false;
		}
		return true;
	}
	window.isp = function(n) {
		if (n = tr(n, 'n'), typeof n !== 'bigint') return n;
		if (n < 2 || n >= B(1) << B(64)) return "n is not in range [2, 2^64)";
		return n < 32 || n == 41 || n == 373 ? !(B(1601558355) >> n & B(1)) : Miller_Rabin(n);
	}
}

let e_main = $('#main')
let e_input = $('.input-text')
let e_html = $('body,html')
let nowPosition = '~'
let commandList = 'ls cat hey hi hello help clear exit zlcak pow isp'.split(' ')
let hisCommand = []
let cour = 0
let isInHis = 0
let directory = []
let files = [{'name':'mobai','content':'stO SJY<br>stO ZLC'},{'name':'AFO','content':'这个菜逼已经退役了呢'}]
let mainFunc = (input, position) => {
  function write(content){
	e_main.html($('#main').html() + '(AFOed)[<span id=\'usr\'>juruo_cjl</span>@<span class="host">caijiblog</span>  ' + position + ']$ '+input+' <br/>'+content)
    e_html.animate({ scrollTop: $(document).height() }, 0)
  }
  if (input === '') {
    write('')
  } else {
    command = input.split(' ')[0]
    
    if (commandList.indexOf(command) === -1) {
	
      write('juruo_cjl: command not found: ' + command + '<br/>')
    } else {
      switch (command) {
        case 'help':
          write('command[ Options...]<br/>You can use following commands:<br/>'+commandList.join('<br>')+'<br/>')
          break
        case 'exit':
          write('(๑˘̴͈́꒵˘̴͈̀)۶ˮ вyё вyё~<br/>')
          window.location.href="/"
          break
        case 'hi':
        case 'hey':
        case 'hello':
          write('Nice to Meet U : )<br/>')
          break
        case 'zlcak':
          var add='';
          if(input.split(' ').length>1)
            add=',ZLC AK '+input.split(' ')[1]
          write('u1s1确实'+add+'<br/>')
          break
        case 'clear':
          e_main.html('')
          e_html.animate({ scrollTop: $(document).height() }, 0)
          break
        case 'pow':
          if (window.BigInt) {
			arg=input.split(' ');
			if(arg.length<4){
				write('candidate expects 3 arguments, '+(arg.length-1)+' provided<br/>')
			}else{
				a=arg[1],n=arg[2],m=arg[3];
				write(pow(a,n,m)+'<br/>')
			}
		  }else {
			write('您的浏览器不资瓷BigInt<br/>')
		  }
		  break
		case 'isp':
          if (window.BigInt) {
			arg=input.split(' ');
			if(arg.length<2){
				write('candidate expects 1 arguments, '+(arg.length-1)+' provided<br/>')
			}else{
				a=arg[1];
				write(isp(a)+'<br/>')
			}
		  }else {
			write('您的浏览器不资瓷BigInt<br/>')
		  }
		  break
		case 'ls':
		  str=""
          for(var i=0;i<files.length;i++){
              str=str+'<span style="color:skyblue">' + files[i].name+ '</span>&nbsp;'
          }
		  write(str+'<br>')
		  break
        case 'cat':
          arg=input.split(' ');
          if(arg.length<2){
            write('candidate expects 1 arguments, '+(arg.length-1)+' provided<br/>')
          }else{
            str='can not find file'
            for(var i=0;i<files.length;i++){
                if(files[i].name==arg[1])
                str=files[i].content;
            }
            write(str+'<br>')
          }
      }
    }
  }
}
let historyCmd = (k) => {
  $('body,html').animate({ scrollTop: $(document).height() }, 0)

  if (k !== 'up' || isInHis) {
    if (k === 'up' && isInHis) {
      if (cour >= 1) {
        cour--
        e_input.val(hisCommand[cour])
      }
    }
    if (k === 'down' && isInHis) {
      if (cour + 1 <= hisCommand.length - 1) {
        cour++
        $(".input-text").val(hisCommand[cour])
      } else if (cour + 1 === hisCommand.length) {
        $(".input-text").val(inputCache)
      }
    }
  } else {
    inputCache = e_input.val()
    e_input.val(hisCommand[hisCommand.length - 1])
    cour = hisCommand.length - 1
    isInHis = 1
  }
}
$(document).bind('keydown', function (b) {
  e_input.focus()
  if (b.keyCode === 13) {
    e_main.html($('#main').html())
    e_html.animate({ scrollTop: $(document).height() }, 0)
    mainFunc(e_input.val(), nowPosition)
    hisCommand.push(e_input.val())
    isInHis = 0
    e_input.val('')
  }
  if (b.keyCode === 9) {
    pressTab(e_input.val())
    b.preventDefault()
    e_html.animate({ scrollTop: $(document).height() }, 0)
    e_input.focus()
  }

  if (b.keyCode === 38) historyCmd('up')
  if (b.keyCode === 40) historyCmd('down')

})
window.onresize = function () {
  e_input.width($(document).width() - $('.prefix').width() - 160)
};
</script>
</body>
</html>